﻿@model LenderDocs.ViewModels.LenderDocRequest
           
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Request Lender Documents</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.simplemodal.1.4.1.min.js")" type="text/javascript"></script>
    <link type="text/css" href="@Url.Content("~/Content/simplemodal/basic.css")" rel='stylesheet' media='screen' />
</head>
<body>

    <div id="docRequest">

        <img src="@Url.Content("~/Content/images/condo-managment-banner2.jpg")" align="right" width="222" /><br />
        @{Html.BeginForm("RequestDocumentPackage", "LenderDoc", FormMethod.Post, new { id = "requestDocs" });}
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <div id="tabStep1">
                        Step One
                    </div>
                </td>
                <td>
                    <div id="tabStep2">
                        Step Two
                    </div>
                </td>
                <td>
                    <div id="tabStep3">
                        Step Three
                    </div>
                </td>
                <td>
                    <div id="tabStep4">
                        Summary
                    </div>
                </td>
            </tr>
        </table>
        <div id="step1">
            <h2>
                Please select from the following.
                <br />
                I am (click on what applies to you):</h2>
            @{string rbValue = "false";}
            <input id="IsHomeSeller" type="radio" name="userType" />
            @Html.LabelFor(model => model.IsHomeSeller)
            <br />
            <input id="IsMortgageCoOrBroker" type="radio" name="userType" />
            @Html.LabelFor(model => model.IsMortgageCoOrBroker)
            <br />
            <input id="IsClosingAttorney" type="radio" name="userType" />
            @Html.LabelFor(model => model.IsClosingAttorney)
            <br />
            <input id="IsRealtor" type="radio" name="userType" />
            @Html.LabelFor(model => model.IsRealtor)
            <br />
            <input id="IsAppraiser" type="radio" name="userType" />
            @Html.LabelFor(model => model.IsAppraiser)
            <br />
            <p align="right">
                <a href="#" class="stepBtn" onclick="goToStep(1, 2);">Next >></a></p>
            </div>
        <div id="step2">
            <h2>
                Requestor's Information</h2>
            <table border="0" cellpadding="2" cellspacing="1" style="width: 500px;">
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.RequestorName)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.RequestorName)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.Phone)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Phone)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        @Html.LabelFor(model => model.Fax)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Fax)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.Email)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Email)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.CommunityName)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.CommunityName)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.Address1)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Address1)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        @Html.LabelFor(model => model.Address2)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Address2)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * City
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.City)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * State
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.State)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * Zip
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Zip)
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        * @Html.LabelFor(model => model.SellerName)
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.SellerName)
                    </td>
                </tr>
            </table>
            <br />
            * @Html.CheckBoxFor(model => model.CertifiedChecked) I certify....
            <br />
            @Html.HiddenFor(model => model.IpAddress)
            IP address is recorded as: @Html.DisplayFor(model => model.IpAddress)
            <br />
            <br />
            <p align="right">
                <a href="#" class="stepBtn" onclick="goToStep(2, 1);"><< Back</a> &nbsp; <a href="#"
                    class="stepBtn" onclick="goToStep(2, 3);">Next >></a></p>
        </div>
        <div id="step3">
            <h2>
                Choose a Package</h2>
            Please select from the following. I am (click on what applies to you):
            <br />
            <br />
            <input id="UniformDisclosurePackage" type="radio" value="@Model != null ? Model.UniformDisclosurePackage : false" name="packageType" />
            @Html.LabelFor(model => model.UniformDisclosurePackage) $135
            <input type="hidden" value="135" id="UniformDisclosurePackageCost" />
            <br />
            <input id="CustomFormsPackage" type="radio" value="@Model != null ? Model.CustomFormsPackage : false" name="packageType" />
            @Html.LabelFor(model => model.CustomFormsPackage) $75 per document
            <input type="hidden" value="75" id="CustomFormsPackageCost" />
            <br />
            <input id="RealtorFormPackage" type="radio" value="@Model != null ? Model.RealtorFormPackage : false" name="packageType" />
            @Html.LabelFor(model => model.RealtorFormPackage) $35
            <input type="hidden" value="35" id="RealtorFormPackageCost" />
            <br />
            <input id="UnpaidAssessmentsPackage" type="radio" value="@Model != null ? Model.UnpaidAssessmentsPackage : false" name="packageType" />
            @Html.LabelFor(model => model.UnpaidAssessmentsPackage) $125
            <input type="hidden" value="125" id="UnpaidAssessmentsPackageCost" />
            <h2>
                Delivery Options
            </h2>
            Normal delivery is 2 business days, by email, for no additional charge.
            <br />
            @Html.CheckBoxFor(model => model.RushDelivery) Add $35.00 Rush Delivery: 4 business
            hours, by email.
            <input type="hidden" value="35" id="RushDeliveryCost" />
            <h2>
                Attorney's Selection</h2>
            @Html.CheckBoxFor(model => model.IsAttorney)
            If you are an attorney, check this box.
            <br />
            <br />
            <p align="right">
                <a class="stepBtn" href="#" onclick="goToStep(3, 2);"><< Back</a> <a href="#" class="stepBtn"
                    onclick="goToStep(3, 4);">Summary >></a></p>
        </div>
        <div id="step4">
        <h2 style="margin:4px; padding:0px">
                Order Summary</h2>
            <table cellpadding="2" cellspacing="1" style="width: 500px">
                <tr>
                    <td class="txtLabel">
                        User Type:
                    </td>
                    <td>
                        <span id="sumUserType"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Requestor Name:
                    </td>
                    <td>
                        <span id="sumRequestorName"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Phone:
                    </td>
                    <td>
                        <span id="sumPhone"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Fax:
                    </td>
                    <td>
                        <span id="sumFax"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Email:
                    </td>
                    <td>
                        <span id="sumEmail"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Community Name:
                    </td>
                    <td>
                        <span id="sumCommunity"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Address Line 1:
                    </td>
                    <td>
                        <span id="sumAddress1"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Address Line 2:
                    </td>
                    <td>
                        <span id="sumAddress2"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        City:
                    </td>
                    <td>
                        <span id="sumCity"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        State:
                    </td>
                    <td>
                        <span id="sumState"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Zip:
                    </td>
                    <td>
                        <span id="sumZip"></span>
                    </td>
                </tr>
                <tr>
                    <td class="txtLabel">
                        Seller Name:
                    </td>
                    <td>
                        <span id="sumSellerName"></span>
                    </td>
                </tr>
            </table>
            <h4 style="margin:0px; padding:0px">
                Pricing Information</h4>
            <table cellpadding="1" cellspacing="1" style="width: 500px; color:#000000;">
                <thead>
                    <tr bgcolor="#CCCCCC">
                        <th>
                            Item
                        </th>
                        <th>
                            Cost
                        </th>
                    </tr>
                </thead>
                <tr bgcolor="#f0f0f0">
                    <td>
                        <div id="sumPackage">
                        </div>
                    </td>
                    <td>
                        <div id="sumPackageCost">
                        </div>
                    </td>
                </tr>
                <tr bgcolor="#ffffd8">
                    <td>
                        <div id="sumRush">
                        </div>
                    </td>
                    <td>
                        <div id="sumRushCost">
                        </div>
                    </td>
                </tr>
       
                <tr bgcolor="white">
                    <td style="color:Red; font-weight:bold">
                        Total
                    </td>
                    <td>
                        <div id="sumTotal" style="color:Red; font-weight:bold">
                        </div>
                        @Html.HiddenFor(model => model.TotalCost)
                        @Html.HiddenFor(model => model.SelectedPackageName)
                    </td>
                </tr>
        
            </table>
            <p align="right">
            <a href="#" class="stepBtn" onclick="goToStep(4, 3);"><< Back</a>
            <br /><br />
            <input id="gotoCheckout" type="submit" value="Place Order >>" title="place order and pay" class="stepBtn" />
    
                </p>
        </div>
        @{Html.EndForm();}

    </div>

    <script language="javascript" type="text/javascript">

        $(document).ready(function () {
            $("#docRequest").modal();
            goToStep(0, 1);
            $("#sendEmail").click(function (ev) { ev.preventDefault(); $("#requestDocs").submit(); });
            $("#gotoCheckout").click(function (ev) { ev.preventDefault(); $("#requestDocs").submit(); });
        });

        function goToStep(fromStep, toStep) {

            switch (fromStep) {
                case 1:
                    //Ensure something is selected
                    if ($("input[name='userType']:checked").val() == undefined) {
                        alert("Please choose a user type");
                        return;
                    }
                    break;
                case 2:
                    //Ensure all required fields are filled in

                    if ($("#RequestorName").val() == "" ||
                    $("#Phone").val() == "" ||
                    $("#Email").val() == "" ||
                    $("#CommunityName").val() == "" ||
                    $("#City").val() == "" ||
                    $("#State").val() == "" ||
                    $("#Zip").val() == "" ||
                    $("#SellerName").val() == "" ||
                    $("#CertifiedChecked").attr("checked") == false) {
                        alert("Please complete all required fields (marked with a *)");
                        return;
                    }

                    if ($("input[name='userType']:checked").attr("id") == "IsClosingAttorney") {
                        $("#IsAttorney").attr("checked", "checked");
                    }
                    break;
                case 3:
                    //Ensure something is selected
                    if ($("input[name='packageType']:checked").val() == undefined) {
                        alert("Please choose a document package");
                        return;
                    }

                    //Fill in summary 
                    //user type
                    var userType = $("input[name='userType']:checked").attr("id");
                    switch (userType) {
                        case "IsHomeSeller":
                            userType = "Home Seller";
                            break;
                        case "IsMortgageCoOrBroker":
                            userType = "Mortgage Company or Broker";
                            break;
                        case "IsClosingAttorney":
                            userType = "Closing Attorney";
                            break;
                        case "IsRealtor":
                            userType = "Realtor";
                            break;
                        case "IsAppraiser":
                            userType = "Appraiser";
                            break;
                    }
                    $("#sumUserType").text(userType);

                    //contact info
                    $("#sumRequestorName").text($("#RequestorName").val());
                    $("#sumPhone").text($("#Phone").val());
                    $("#sumFax").text($("#Fax").val());
                    $("#sumEmail").text($("#Email").val());
                    $("#sumCommunity").text($("#CommunityName").val());
                    $("#sumAddress1").text($("#Address1").val());
                    $("#sumAddress2").text($("#Address2").val());
                    $("#sumCity").text($("#City").val());
                    $("#sumState").text($("#State").val());
                    $("#sumZip").text($("#Zip").val());
                    $("#sumSellerName").text($("#SellerName").val());

                    var packageType = $("input[name='packageType']:checked").attr("id");
                    var packageCost = 0;
                    var total = 0;

                    switch (packageType) {
                        case "UniformDisclosurePackage":
                            packageType = "Uniform Disclosure Package";
                            total = parseInt($("#UniformDisclosurePackageCost").val());
                            packageCost = "$" + $("#UniformDisclosurePackageCost").val();
                            break;
                        case "CustomFormsPackage":
                            packageType = "Custom Forms Package";
                            total = parseInt($("#CustomFormsPackageCost").val());
                            packageCost = "$" + $("#CustomFormsPackageCost").val() + " per document";
                            break;
                        case "RealtorFormPackage":
                            packageType = "Realtor Form Package";
                            total = parseInt($("#RealtorFormPackageCost").val());
                            packageCost = "$" + $("#RealtorFormPackageCost").val();
                            break;
                        case "UnpaidAssessmentsPackage":
                            packageType = "Unpaid Assessments Package";
                            total = parseInt($("#UnpaidAssessmentsPackageCost").val());
                            packageCost = "$" + $("#UnpaidAssessmentsPackageCost").val();
                            break;
                    }

                    $("#SelectedPackageName").val(packageType);
                    $("#sumPackage").text(packageType);
                    $("#sumPackageCost").text(packageCost);

                    //Rush Delivery
                    if ($("input[id='RushDelivery']:checked").val() == "true") {
                        $("#sumRush").text("Rush Delivery");
                        total += parseInt($("#RushDeliveryCost").val());
                        $("#sumRushCost").text("$" + $("#RushDeliveryCost").val());
                    }
                    else {
                        $("#sumRush").text("");
                        $("#sumRushCost").text("");
                    }

                    $("#TotalCost").val(total);

                    if (packageType == "Custom Forms Package") {
                        $("#sumTotal").text("$" + total + " (minimum)");
                    }
                    else {
                        $("#sumTotal").text("$" + total);
                    }

            }

            var tabCount = 4;
            var currentTabId = "";

            //Set tab style and hide all divs
            for (var i = 1; i <= tabCount; i++) {

                currentTabId = "#tabStep" + i.toString();

                $(currentTabId).removeClass("activeTab");
                $(currentTabId).addClass("inactiveTab");

                currentDiv = "#step" + i.toString();
                $(currentDiv).hide();
            }

            //Set active tab style
            var selectedTabId = "#tabStep" + toStep.toString();
            $(selectedTabId).removeClass("inactiveTab");
            $(selectedTabId).addClass("activeTab");

            //Show selected step
            var selectedStep = "#step" + toStep.toString();
            $(selectedStep).show();
        }

        function submitForm() {
            ev.preventDefault();
            $("#requestDocs").submit();
        }
</script>

</body>
</html>